CONST APPHELP = 900
CONST ASKQUIT = 200
CONST AUTOMATIC_INSTALL = 2100
CONST BB_MAILMAN = 5800
CONST BUILDING_FILES = 800
CONST CANT_DELETE_AUTO = 5700
CONST CONFIG_PAGE = 2300
CONST CONTROLS = 2500
CONST CONTROLS_EGA = 2501
CONST CUSTOM_INSTALL = 1100
CONST ENABLE_PM = 100
CONST EXITFAILURE = 400
CONST EXITSUCCESS = 700
CONST EXPLAIN_PAGE = 3000
CONST FNTSLIDER_DLG = 1200
CONST FONT_SELECTION = 1300
CONST IGNORE_REDIRECT = 6900
CONST INCOMPAT_CART = 6700
CONST INCOMPAT_DRIVER = 6600
CONST INCOMPAT_EXIT = 6800
CONST INFO_REQUIRED = 7700
CONST INSTALL_COMPLETE = 2600
CONST INSTALL_METHOD = 1500
CONST INSTALL_NOTHING = 300
CONST INSTALL_NO_DRIVER = 1700
CONST INVALID_VERSION_CODE = 6000
CONST JUMBO_CONNECTION = 1800
CONST JUMBO_WAITING = 600
CONST NO_CONFIG_PAGE = 2800
CONST NO_LOCAL_PRINTER = 2000
CONST NO_SPACE = 1600
CONST PRINTER_CONFIG = 2400
CONST PRINTER_LIST_EMPTY = 6300
CONST PRINT_PORT_SELECT = 2200
CONST REBOOT_NO_TTE = 1900
CONST RESTART_TRUETYPE = 5900
CONST UPDATE_CART = 6500
CONST UPDATE_DRIVER = 6400
CONST USE_VERSION = 6200
CONST VERIFY = 3100
CONST WELCOME1 = 1000
CONST HELP_ASKQUIT = 7200
CONST HELP_CDCONFIRMINFO = 8100
CONST HELP_CDGETNAMEORG = 7900
CONST HELP_COMM_ERROR = 5300
CONST HELP_CONFIG_PAGE = 5200
CONST HELP_CONFIRM_NC = 4000
CONST HELP_CUSTOM_INST = 4600
CONST HELP_ENABLE_PM = 4900
CONST HELP_EXITFAILURE = 6200
CONST HELP_EXITSUCCESS = 7000
CONST HELP_FONTS_SELECT = 4700
CONST HELP_IGNORE_REDIRECT = 8300
CONST HELP_INCOMPAT_CART = 8500
CONST HELP_INCOMPAT_DRIVER = 8400
CONST HELP_INCOMPAT_EXIT = 8800
CONST HELP_INFO_REQUIRED = 8200
CONST HELP_INSTALL_PRINTERS = 5500
CONST HELP_INST_METHOD = 4500
CONST HELP_INVALID_VERSION_CODE = 9000
CONST HELP_LEGAL = 3600
CONST HELP_MANUAL_CONFIG = 5400
CONST HELP_NOACTION = 3900
CONST HELP_NOSPACE = 4100
CONST HELP_NOTT = 3200
CONST HELP_NO_DELETE = 5100
CONST HELP_NO_DRIVER = 4800
CONST HELP_NO_LOCAL = 4300
CONST HELP_PORT_SEARCH = 5000
CONST HELP_PORT_SELECT = 4400
CONST HELP_PRINTER_LIST_EMPTY = 8900
CONST HELP_RESTART_TRUETYPE = 9100
CONST HELP_RESTARTWIN = 3300
CONST HELP_WELCOME = 3400
CONST HELP_VERIFY = 7800
CONST HELP_UPDATE_CART = 8600
CONST HELP_UPDATE_DRIVER = 8700
CONST ENHANCED_MODE_REQUIRED = 8000
CONST HELP_ENHANCED_MODE_REQUIRED = 9300
CONST FALSE = 0
CONST TRUE = 1
CONST WM_FONTCHANGE = &H001D
CONST WM_WININICHANGE = &H001A
CONST WM_SYSCOMMAND% = 274
CONST SC_MAXIMIZE% = 61488
CONST YES% = 6
CONST NO% = 7
CONST DEFAULT_COMPAT$ = "10106"
CONST DEFAULT_VERSION$ = "10"
CONST DEFAULT_RH$ = "10"
CONST DEFAULT_NAME$ = "WinLaser 400"
CONST PCLFP$ = "wpslafp.exe"
CONST iYES% = 1
CONST iNO% = 0
CONST iOK% = 1
CONST iSTOP% = 0
CONST iON% = 1
CONST iOFF% = 0
CONST dwNULL& = 0
CONST iNULL% = 0
CONST DRIVERFILES = 1
CONST SOUNDFILES = 2
CONST FONTFILES = 3
CONST REQUIREDPOS = 4
CONST AVAILPOS = 5
CONST EXIT_SELECT_STUFF = 0
CONST METHOD_SELECT = 1
CONST CUSTOM_SELECT = 3
CONST PRINTER_SOURCE = 9
CONST CHOOSE_CONNECT = 10
CONST PRINT_PORT_SLT = 11
CONST PRINTER_INFO = 13
CONST AUTO_INSTALL = 12
CONST MAX_COMPONENT = 3
CONST MAX_PRINTER = 16
CONST MAXPATH = 256
CONST MAX_STACK_ITEM = 20
CONST iMB_RETRYCANCEL% = 5
CONST iMB_OKCANCEL% = 1
CONST iMB_OK% = 0
CONST iIDCANCEL% = 2
CONST iSW_MAXIMIZE% = 3
GLOBAL iStatus%
GLOBAL WinDrive$
GLOBAL WinDir$
GLOBAL WinSysDir$
GLOBAL WinSysDrive$
GLOBAL SrcDir$
GLOBAL TestPageDir$
GLOBAL CursorSave%
GLOBAL PortAdding$
GLOBAL InstallPM%
GLOBAL InstallSpeaker%
GLOBAL IniKeySpooler%
GLOBAL DriverSize&
GLOBAL SoundSize&
GLOBAL DiskSpaceFree&
GLOBAL TotalInstallSize&
GLOBAL TotalFontSize&
GLOBAL PrinterAddingIndex%
TYPE pDWsize
size AS Long
END TYPE
GLOBAL lpwNetSize AS pDWsize
GLOBAL iStepStack(MAX_STACK_ITEM) AS INTEGER
GLOBAL iTopItem%
GLOBAL iStep%
GLOBAL nDrive%
GLOBAL ClusterByte&
GLOBAL dwComponentSize(MAX_COMPONENT) AS LONG
GLOBAL dwSaveComponentSize(MAX_COMPONENT) AS LONG
DECLARE FUNCTION GetTempFileName LIB "kernel" (a%,b$,c%,d$) AS INTEGER
DECLARE FUNCTION GetProfileInt LIB "kernel" (a$,b$,c%) AS INTEGER
DECLARE FUNCTION WinExec LIB "kernel" (a$, b%) AS INTEGER
DECLARE FUNCTION SetErrorMode LIB "kernel" (a%) AS INTEGER
DECLARE FUNCTION GetPrivateProfileString LIB "kernel" (a$,b$,c$,d$,e%,f$) AS INTEGER
DECLARE FUNCTION CloseComm LIB "user" (a%) AS INTEGER
DECLARE FUNCTION GetAsyncKeyState LIB "user" (a%) AS INTEGER
DECLARE FUNCTION ExitWindowsExec LIB "user" (a$, b$) AS INTEGER
DECLARE FUNCTION OpenComm LIB "user" (a$,b%,c%) AS INTEGER
DECLARE FUNCTION PostMessage LIB "user" (a%,b%,c%,d$) AS INTEGER
DECLARE FUNCTION SendMessage LIB "user" (a%,b%,c%,d$) AS INTEGER
DECLARE FUNCTION SendDlgItemMessage LIB "user" (a%,b%,c%,d%,e&) AS INTEGER
DECLARE FUNCTION WNetConnectionDialog LIB "user" (a%,b%) AS INTEGER
DECLARE FUNCTION WNetConnectDialog LIB "user" (a%,b%) AS INTEGER
DECLARE FUNCTION WNetGetConnection LIB "user" (a$,b$,c AS ANY) AS INTEGER
DECLARE FUNCTION WNetGetCaps LIB "user" (a%) AS INTEGER
DECLARE FUNCTION AddFontResource LIB "gdi" (a$) AS INTEGER
DECLARE SUB DebugText LIB "mscuistf.dll" (a$)
DECLARE SUB FCleanupFontDialog LIB "mscuistf.dll" ()
DECLARE SUB FEnableControls LIB "mscuistf.dll" (a%)
DECLARE SUB FInitAutoDialog LIB "mscuistf.dll" ()
DECLARE SUB FInitInfoDialog LIB "mscuistf.dll" ()
DECLARE SUB FInitInfo0Dialog LIB "mscuistf.dll" ()
DECLARE SUB FInitMultiDialog LIB "mscuistf.dll" ()
DECLARE SUB FixINFIniFiles LIB "mscuistf.dll" (a$, b$, c$)
DECLARE SUB FixPrinterIniFiles LIB "mscuistf.dll" (a%)
DECLARE FUNCTION DWGetSpaceCost LIB "mscuistf.dll" (i%,j&,a$,b$) as long
DECLARE SUB FInitInstallMethodDialog LIB "mscuistf.dll" (a$, b&)
DECLARE SUB FInitVersionDialog LIB "mscuistf.dll" (a$, b$)
DECLARE SUB FRemoveValFromIniKey LIB "mscuistf.dll" (a$, b$, c$, d$)
DECLARE SUB InitPrinterConfigDlg LIB "mscuistf.dll" (a%)
DECLARE FUNCTION PrinterSetup LIB "mscuistf.dll" (a%,b%) AS INTEGER
DECLARE FUNCTION FileToComm LIB "mscuistf.dll" (szFile$, szComm$, w%)
DECLARE FUNCTION DiskClusterUnit LIB "mscuistf.dll" (a%)
DECLARE FUNCTION GetPrinterNum LIB "mscuistf.dll" (a$) AS INTEGER
DECLARE FUNCTION FarGetPortAddr LIB "wpscom.dll" (a%) AS INTEGER
DECLARE FUNCTION SafeCreateFOT LIB "fontname.dll" (a%,b$,c$,d$) AS INTEGER
DECLARE FUNCTION GetFontFacename LIB "fontname.dll" (a$,b$,c%) AS INTEGER
DECLARE SUB DlgInstallNoSpace
DECLARE FUNCTION DlgInstallNoDriver() AS INTEGER
DECLARE FUNCTION DlgPrintPage() AS INTEGER
DECLARE FUNCTION DlgNoPrintMgr() AS INTEGER
DECLARE SUB DlgInvalidVersionCode
DECLARE SUB DoInCompatQuit
DECLARE SUB DoAskQuit
DECLARE SUB Box (a$, b$)
DECLARE SUB InfoDlgOneButton(szText$, idDlg%, idHelpDlg%)
DECLARE SUB InfoDlgAOneButton(szText$, idDlg%, idHelpDlg%)
DECLARE SUB ToggleCheckStatus (a$, b%)
DECLARE SUB SetSpaceStatus
DECLARE SUB DeleteDir(szDir$)
DECLARE FUNCTION GetTempDirName AS STRING
DECLARE FUNCTION InvalidVersionCode(lCode as LONG) AS INTEGER
DECLARE FUNCTION SumNumericList (List$, first%, last%) AS LONG
DECLARE SUB CleanUp
DECLARE FUNCTION itoa (a&) AS STRING
DECLARE FUNCTION DollarFormat (a&) AS STRING
DECLARE SUB ResetStepStack
DECLARE FUNCTION PushStep(a%, b%) AS INTEGER
DECLARE FUNCTION PopStep() AS INTEGER
SUB DlgInstallNoSpace STATIC
DIM bDoInstallNoSpace%
bDoInstallNoSpace = TRUE
WHILE bDoInstallNoSpace
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, NO_SPACE, "FInfoDlgProc", HELP_NOSPACE, "FHelpDlgProc")
IF (sz$ = BTN_BACK$) OR (sz$ = BTN_CUSTOM$) OR (sz$ = BTN_CANCEL$) THEN
UIPop 1
bDoInstallNoSpace = FALSE
ELSEIF sz$ = BTN_FILEMGR$ THEN
i% = WinExec("winfile.exe", iSW_MAXIMIZE%)
IF i% < 32 THEN
sz$ = MSG_FILEMGR1$ + MSG_FILEMGR2$ + MSG_FILEMGR3$
i% = DoMsgBox(sz$, MSG_FMTITLE$, 48)
END IF
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END SUB
FUNCTION DlgInstallNoDriver() STATIC AS INTEGER
DIM bDoInstallNoDriver%
bDoInstallNoDriver = TRUE
WHILE bDoInstallNoDriver
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, INSTALL_NO_DRIVER, "FInfoDlgProc", HELP_NO_DRIVER, "FHelpDlgProc")
IF sz$ = BTN_CONTINUE$ THEN
UIPop 1
DlgInstallNoDriver = iYES%
bDoInstallNoDriver = FALSE
ELSEIF (sz$ = BTN_BACK$) OR (sz$ = BTN_CANCEL$) THEN
UIPop 1
DlgInstallNoDriver = iNO%
bDoInstallNoDriver = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END FUNCTION
FUNCTION DlgPrintPage() STATIC AS INTEGER
DIM bDoPrintPage%
bDoPrintPage = TRUE
WHILE bDoPrintPage
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, CONFIG_PAGE, "FInfoDlgProc", HELP_CONFIG_PAGE, "FHelpDlgProc")
IF sz$ = BTN_YES$ THEN
IF mid$(PortAdding$, 9, 3) = mid$(MSG_NOTPRESENT$, 1, 3) THEN
UIPop 1
InfoDlgOneButton BTN_OK$, NO_CONFIG_PAGE, HELP_COMM_ERROR
ELSE
CursorSave% = ShowWaitCursor()
sz$ = GetIniKeyString (INI_WININI$, INI_WINDOWS$, INI_DEVICE$)
i% = FileToComm(GetSymbolValue(SYM_CWDDIR$)+FILE_CONFIGPAGE$, MID$(PortAdding$, 1, 4),HwndFrame())
RestoreCursor CursorSave%
CursorSave% = 0
UIPop 1
IF i% = TRUE THEN
InfoDlgOneButton BTN_OK$, NO_CONFIG_PAGE, HELP_COMM_ERROR
ENDIF
END IF
DlgPrintPage = PRINTER_INFO
bDoPrintPage = FALSE
ELSEIF (sz$ = BTN_NO$) THEN
UIPop 1
DlgPrintPage = PRINTER_INFO
bDoPrintPage = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END FUNCTION
FUNCTION DlgNoPrintMgr STATIC AS INTEGER
DIM bDoNoPrintMgr%
DlgNoPrintMgr = 2
bDoNoPrintMgr = TRUE
WHILE bDoNoPrintMgr
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, ENABLE_PM, "FInfoDlgProc", HELP_ENABLE_PM, "FHelpDlgProc")
IF sz$ = BTN_YES$ THEN
UIPop 1
InstallPM% = YES%
DlgNoPrintMgr = 1
bDoNoPrintMgr = FALSE
ELSEIF sz$ = BTN_NO$ THEN
UIPop 1
InstallPM% = NO%
bDoNoPrintMgr = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END FUNCTION
SUB DlgInvalidVersionCode STATIC
DIM bDoInvalidVersionCode%
bDoInvalidVersionCode = TRUE
WHILE bDoInvalidVersionCode
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, INVALID_VERSION_CODE, "FConfirmDlgProc", HELP_INVALID_VERSION_CODE, "FHelpDlgProc")
IF (sz$ = BTN_OK$) THEN
UIPop 1
bDoInvalidVersionCode = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END SUB
SUB DoInCompatQuit STATIC
FEnableControls FALSE
sz$ = UIStartDlg(DLL_CUIDLL$, INCOMPAT_EXIT, "FQuitDlgProc", HELP_INCOMPAT_EXIT, "FHelpDlgProc")
WHILE sz$ = VAL_REACTIVATE$
sz$ = UIStartDlg(DLL_CUIDLL$, ASKQUIT, "FQuitDlgProc", HELP_ASKQUIT, "FHelpDlgProc")
WEND
IF sz$ = BTN_EXITINSTALL$ THEN
UIPopAll
END
ELSE
UIPop 1
END IF
FEnableControls TRUE
sz$ = ""
END SUB
SUB DoAskQuit STATIC
FEnableControls FALSE
sz$ = UIStartDlg(DLL_CUIDLL$, ASKQUIT, "FQuitDlgProc", HELP_ASKQUIT, "FHelpDlgProc")
WHILE sz$ = VAL_REACTIVATE$
sz$ = UIStartDlg(DLL_CUIDLL$, ASKQUIT, "FQuitDlgProc", HELP_ASKQUIT, "FHelpDlgProc")
WEND
IF sz$ = BTN_EXITINSTALL$ THEN
UIPopAll
CleanUp
END
ELSE
UIPop 1
END IF
FEnableControls TRUE
sz$ = ""
END SUB
SUB Box (message$, title$) STATIC
iRet% = DoMsgBox (message$, title$, iMB_OKCANCEL)
IF iRet% = iIDCANCEL% THEN
DoAskQuit
END IF
END SUB
SUB InfoDlgOneButton(szText$, idDlg%, idHelpDlg%) STATIC
DIM bDoLoop%
bDoLoop = TRUE
WHILE bDoLoop
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, idDlg%, "FInfoDlgProc", idHelpDlg%, "FHelpDlgProc")
IF (sz$ = szText$) THEN
UIPop 1
bDoLoop = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END SUB
SUB InfoDlgAOneButton(szText$, idDlg%, idHelpDlg%) STATIC
DIM bDoLoop%
bDoLoop = TRUE
WHILE bDoLoop
sz$ = UIStartDlg(DLL_CUIDLL$, idDlg%, "FInfoDlgProc", idHelpDlg%, "FHelpDlgProc")
IF (sz$ = szText$) THEN
UIPop 1
bDoLoop = FALSE
ELSEIF sz$ = BTN_EXIT$ THEN
DoAskQuit
END IF
WEND
sz$ = ""
END SUB
SUB ToggleCheckStatus (CheckList$, ftype%) STATIC
if GetListItem (CheckList$, ftype%) = VAL_CHKOFF$ then
ReplaceListItem CheckList$, ftype%, VAL_CHKON$
else
ReplaceListItem CheckList$, ftype%, VAL_CHKOFF$
end if
END SUB
SUB SetSpaceStatus() STATIC
TotalInstallSize = 0
FOR i% = 1 TO MAX_COMPONENT
TotalInstallSize = TotalInstallSize + dwComponentSize(i%)
NEXT i%
ReplaceListItem SYM_CUSTOMSTATUSTEXT$, REQUIREDPOS, DollarFormat(TotalInstallSize/1024)
DiskSpaceFree = GetFreeSpaceForDrive(WinSysDrive$)
ReplaceListItem SYM_CUSTOMSTATUSTEXT$, AVAILPOS, DollarFormat(DiskSpaceFree/1024)
END SUB
SUB DeleteDir(szDir$) STATIC
CLEARLIST
SETFILE szDir$+"\*.*", ON
FOR FileName$ IN FILELIST
junk% = YnrcRemoveFile(FileName$, 256)
NEXT
IF Mid$(GetSymbolValue (SYM_CWDDIR$), 1, 1) <> Mid$(szDir$, 1, 1) THEN
ChDir Mid$(szDir$, 1, 2) + ".."
END IF
RmDir szDir$
FileName$ = ""
END SUB
FUNCTION GetTempDirName STATIC AS STRING
tmpPath$ = STRING$(32,MAXPATH)
tmpCode% = GetTempFileName (0, "zzz", 0, tmpPath$)
KILL tmpPath$
SPLITPATH tmpPath$,tmpDrv$,tmpDir$,tmpName$,tmpExt$
if LEN(tmpDir$) > 1 THEN
tmpDir$ = MID$(tmpDir$,1,LEN(tmpDir$)-1)
END IF
GetTempDirName = tmpDrv$ + tmpDir$
tmpPath$ = ""
tmpDrv$ = ""
tmpDir$ = ""
tmpName$ = ""
tmpExt$ = ""
END FUNCTION
FUNCTION InvalidVersionCode(lCode as LONG) STATIC AS INTEGER
DIM iDigit1%, iDigit2%, iDigit3%, iDigit4%, iCheckDigit%
DIM lCart&, lCompat&
InvalidVersionCode = TRUE
iCheckDigit% = lCode MOD 10
lCart = lCode / 100
lCompat = lCode MOD 100
lCode = lCode / 10
iDigit1% = lCode MOD 10
lCode = lCode / 10
iDigit2% = lCode MOD 10
lCode = lCode / 10
iDigit3% = lCode MOD 10
lCode = lCode / 10
iDigit4% = lCode MOD 10
IF (iDigit4% < 10) AND (lCart >= lCompat) THEN
iCalcDigit% = iDigit4% + iDigit3% * 3 + iDigit2% * 5 + iDigit1% * 7
IF (iCheckDigit% = (iCalcDigit% MOD 10)) THEN
InvalidVersionCode = FALSE
END IF
END IF
END FUNCTION
FUNCTION SumNumericList (List$, first%, last%) STATIC AS LONG
IF last% = 0 THEN
last% = GetListLength (List$)
END IF
sum& = 0
FOR j% = first% TO last%
sum& = sum& + VAL(GetListItem(List$, j%))
NEXT j%
SumNumericList = sum&
END FUNCTION
SUB CleanUp() STATIC
CursorSave% = ShowWaitCursor
FRemoveValFromIniKey INI_WININI$, INI_WINDOWS$, INI_RUN$, INI_TESTPAGE$
szDir$ = WinDir$+TestPageDir$
IF FDirExists(szDir$) <> 0 THEN
DeleteDir szDir$
END IF
RestoreCursor(CursorSave%)
szDir$ = ""
END SUB
FUNCTION itoa (x&) STATIC AS STRING
s$ = STR$(x&)
if x& >= 0 THEN
s$ = MID$(s$,2)
END IF
itoa = s$
END FUNCTION
FUNCTION DollarFormat (num&) STATIC AS STRING
szThousand$ = GetIniKeyString (INI_WININI$, INI_INTL$, INI_THOUSAND$)
sz$ = STR$(num&)
i% = Len (sz$)
szResult$ = Mid$(sz$, i%, 1)
for j% = i%-1 to 2 step -1
if (i% - j%) Mod 3 = 0 then
szResult$ = szThousand$ + szResult$
end if
szResult$ = Mid$(sz$, j%, 1) + szResult$
next j%
DollarFormat = szResult$
szThousand$ = ""
sz$ = ""
END FUNCTION
SUB ResetStepStack STATIC
iTopItem = 0
END SUB
FUNCTION PushStep(iCurStep%, iNextStep%) STATIC AS INTEGER
DIM iIdx%, bNotExist%, bDoLoop%
IF iTopItem > MAX_STACK_ITEM THEN
PushStep = FALSE
ELSE
iStepStack(iTopItem) = iCurStep
iTopItem = iTopItem + 1
PushStep = TRUE
END IF
END FUNCTION
FUNCTION PopStep() STATIC AS INTEGER
IF iTopItem <= 0 THEN
PopStep = -1
ELSE
iTopItem = iTopItem - 1
PopStep = iStepStack(iTopItem)
END IF
END FUNCTION
